<{include file='customer/head.html'}>
<style type="text/css">
	.hcinits_uploads_file_attachment_name{position: relative;padding: 0 5px;background: #ccc;color: #fff;width: 90%;}
	.attachment_file_del{color: red;position: absolute;right: -20px;top: 0;font-size: 34px;}
</style>
<body>
	<div class="akrPop">
		<form id="sub_form">
			<ul class="fl ulForm-2" style="width: 37%;">
				<li>
					<label class="form-label">项目：</label>
					<div class="form-input">
						<select name="prjid" disabled>
							<{foreach $prolist as $k=>$v}>
							<option <{if $v.id==$list.prjid}>selected<{/if}> value="<{$v.id}>"><{$v.name}></option>
							<{/foreach}>
						</select>
					</div>
				</li>
				<li>
					<label class="form-label">是否加急：</label>
					<div class="form-input">
						<input type="radio" name="isquick" <{if $list.isquick==0}>checked<{/if}> value="0" >否
						<input type="radio" name="isquick" <{if $list.isquick==1}>checked<{/if}> value="1" >是
					</div>
				</li>
				<li>
					<label class="form-label">附件上传：</label>
					<div class="form-input">
						<!-- //上传附件显示 -->
						<div class="hcinits_uploads_file_attachment_name">
							<{foreach $getattachmentlist as $k=>$v}>
							<div>
								<div class="attachment_file_download" data-id-dwonload="<{$v.download}>"><{$v.filename}></div>
								<div class="attachment_file_del" data-id-del="<{$v.filepath}>">×</div>
							</div>
							<{/foreach}>
						</div>
						<div class="akrfile">双击下载附件
							<input type="hidden" name="attachment" class="hcinits_uploads_file_attachment_httpurl" value="<{$attachmentliststr}>">
							<div class="hcinits_uploads_file" id="uploadone"></div>
						</div>
					</div>
				</li>
				<li>
					<label class="form-label">需要时间：</label>
					<div class="form-input">
						<input type="text" name="needtime" value="<{$list.needtime}>" class="inputText">
					</div>
				</li>
				<li>
					<label class="form-label">变动原因：</label>
					<div class="form-input">
						<input type="text" name="modifyrecord" value="<{$list.modifyrecord}>" class="inputText">
					</div>
				</li>
			</ul>
			<div class="fl" style="width: 60%;margin-left: 2%;line-height: 30px;">
				<label class="form-label">描述：</label>
				<div class="form-input">
					<textarea name="description" style="width:100%;height:400px;" id="content"><{$list.description}></textarea>
				</div>
			</div>
			<div style="position: fixed;right: 1%;bottom: 5px;z-index: 999;">
				<input type="hidden" name="id" value="<{$list.id}>">
				<input type="button" class="sub_form_botton akrBtn akrBtn-lg blue" value="提交">
			</div>
		</form>
	</div>
<script type="text/javascript">
	 var cmsurl='<{$pmsroot}>/Ueditor/UeditorController/comindex';
	 var cmsroot='<{$pmsroot}>/';
	 var cmsupload='<{$pmsroot}>';
	 var ue;
</script>
<script type="text/javascript" charset="utf-8" src="/static/js/plugins/ueditor/ueditor.config.js?version=<{$getconfig.admin_jscss_version}>"></script>
<script type="text/javascript" charset="utf-8" src="/static/js/plugins/ueditor/ueditor.all.js?version=<{$getconfig.admin_jscss_version}>"> </script>
<script type="text/javascript" charset="utf-8" src="/static/js/plugins/ueditor/lang/zh-cn/zh-cn.js?version=<{$getconfig.admin_jscss_version}>"></script>
<script type="text/javascript">
	$(function(){
		ue = UE.getEditor('content',{
			initialFrameWidth:'100%',
			initialFrameHeight:'300',
			wordCount:false,
			elementPathEnabled:false,
			//enableContextMenu: false,
			allowDivTransToP:false,
			autoHeightEnabled:true,
			autoFloatEnabled:true,
            //topOffset:100,
			//initialStyle:'p{line-height:1em;font-size:14px;}'
		});
	})
</script>
<script type="text/javascript">
	//上传单张图片
	function uploadimgone(){
		var postdata={savePath:'attachment'};
		var uploadid='uploadone';
		var formAction='/Ups/attachmentmore';
		_hcinits.init(['_upload_min','_layer_admin_min'],function(){ 
			_layer_admin=_hcinits._layer_admin;
			_uploadfile=_hcinits._uploadfile;
			_uploadfile.initdiv({'upId':uploadid,'formInputFileMultiple':true,'formInputFileName':'upfilemore[]','formAction':formAction},postdata,function(returnback){
            	data=JSON.parse(returnback[0]);
            	if(data.errinfo!=0){
            		_layer_admin.errorMsg(data.errinfo);
            	}
            	if(data.info){
	               // var arr=Object.keys(data.info);
	                var len=data.info.length;
	                var defaultpicurl='';
	                defaultpicurl=$('.hcinits_uploads_file_attachment_httpurl').val();
	                if(defaultpicurl!=''){defaultpicurl+=',';}
	                for(i=0;i<len;i++){
	                    var filestr='';
	                    defaultpicurl+=data.info[i]['img']+",";
	                    filestr+='<div>';
						filestr+='<div class="attachment_file_download" data-id-dwonload="'+data.info[i]['imgshow']+'">'+data.info[i]['fileshowname']+'</div>';
						filestr+='<div class="attachment_file_del" data-id-del="'+data.info[i]['img']+'">×</div>';
						filestr+='</div>';
	                    $('.hcinits_uploads_file_attachment_name').append(filestr);
	                }
	                if(defaultpicurl!=''){
	                    defaultpicurl=defaultpicurl.substring(0,defaultpicurl.length-1);
	                }
	                $('.hcinits_uploads_file_attachment_httpurl').val(defaultpicurl);
            	}
			});
		})
	}
	uploadimgone(); 
	$(function(){
		//下载
		$('.hcinits_uploads_file_attachment_name').on('dblclick','.attachment_file_download',function(){
			var downloadurl=$(this).attr('data-id-dwonload');
			window.location.href=downloadurl;
		})		
		//删除 未删除资源
		$('.hcinits_uploads_file_attachment_name').on('click','.attachment_file_del',function(){
			var curdelurl=$(this).attr('data-id-del');
			$(this).parent('div').remove();
			var picstr=$('.hcinits_uploads_file_attachment_httpurl').val();
			if(picstr!=''){
				var picstr_arr=picstr.split(',');
				var picstr_arr_length=picstr_arr.length;
				var arri='';
				for(i=0;i<picstr_arr_length;i++){
					if(curdelurl==picstr_arr[i]){
						arri=i;
						break;
					}
				}
				picstr_arr.splice(arri,1);
				var newpicst=picstr_arr.join(',');
				$('.hcinits_uploads_file_attachment_httpurl').val(newpicst);
			}
		})
		//添加提交
		$('.sub_form_botton').click(function(){
			_hcinits.init(['_ajaxs_min','_layer_admin_min'],function(){
				_ajaxs=_hcinits._ajaxs;
				_layer_admin=_hcinits._layer_admin;
				 postdata=_ajaxs.from('#sub_form');
				_ajaxs.post('/ProjectRecord/projectRecordEdit',postdata,function(data){
					if(data.status){
						_layer_admin.successMsg(data.message,3)
					}else{
						_layer_admin.errorMsg(data.message);
					}
				})
			})
		})
	})
</script>
</body>
 
</html>